package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author LF
 * @date 2021/4/21 - 14:47
 */
@Configuration
@EnableConfigurationProperties(IDProperties.class)
public class IDConfiguration {
    @Autowired
    private IDProperties idProperties;

    @Bean
    @ConditionalOnMissingBean(IDService.class)
    public IDService idService(){
        return new IDService(idProperties);
    }
}
